<?php

declare (strict_types=1);
namespace App\Model;

use Hyperf\Database\Model\SoftDeletes;
use Hyperf\DbConnection\Model\Model;
/**
 * @property int $id 
 * @property int $position_id 
 * @property string $question 
 * @property int $input_type 
 * @property string $options 
 * @property string $standard 
 * @property \Carbon\Carbon $created_at 
 * @property \Carbon\Carbon $updated_at 
 * @property string $deleted_at 
 */
class PositionPaper extends Model
{
    use SoftDeletes;
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'position_paper';
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'category_id',
        'position_id',
        'input_type',
        'question',
        'options',
        'score',
        'standard',
        'listorder',
        'config'
    ];
    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = ['id' => 'int', 'category_id' => 'integer','position_id' => 'integer', 'input_type' => 'integer', 'score'=>'integer','created_at' => 'datetime', 'updated_at' => 'datetime'];


    public function getConfigAttribute($field)
    {
        return $this->attributes[$field] = $field?json_decode($field,true):new \stdClass();
    }

}